package com.cn.goodsadmin.dao.impl;

import com.cn.goodsadmin.dao.BaseDao;
import com.cn.goodsadmin.dao.ILogisticsdicDao;
import com.cn.goodsadmin.po.Logisticsdic;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository("LogisticsdicDaoImpl")
public class LogisticsdicDaoImpl extends BaseDao<Logisticsdic> implements ILogisticsdicDao {
    @Override
    public List<Logisticsdic> findAllLogisticsDic() throws Exception {
        StringBuilder builder=new StringBuilder();
        builder.append("from Logisticsdic");
        return find(builder.toString());
    }

    @Override
    public List<Logisticsdic> findLogisticsDicByStr( String logisticName) throws Exception {
        StringBuilder builder=new StringBuilder();
        List<Object> paraList=new ArrayList<Object>();
        builder.append("from Logisticsdic l where 1=1");
        if(logisticName!=null){
            builder.append(" and l.cName like ?0");
            paraList.add("%"+logisticName+"%");
        }
        return find(builder.toString(),paraList.toArray());
    }
}
